<template>
  <div id="dictAdd">
    <dict-add-and-edit-table @submitDictInfo="submitDictInfo" />
  </div>
</template>

<script>
import { addDict } from '@/assets/request/api'
import dictAddAndEditTable from './dictAddAndEditTable.vue'
export default {
  components: { dictAddAndEditTable },
  name: "dictAdd",
  data() {
    return {
      parentId : ''
    }
  },
  methods: {
    submitDictInfo(dictInfo) {
      dictInfo.parentId = this.$route.params.id

      addDict(dictInfo).then(res => {
        this.$message({
          message: '新增成功',
          type: "success"
        });
        this.$router.push({'name':"dictManagement"})
      }).catch(err => {
        this.$message({
          message: err.message,
          type: "error"
        });
      })
    }
  },
}
</script>

<style lang="scss" scoped>

</style>